package com.eryos.android.cigarettecounter.beans;

/**
 * Project : CigaretteCounter Author : Olivier Combe URL : http://eryos.fr/CigaretteCounter/
 * 
 * Copyright(C)2011 - Olivier Combe
 * 
 * Licensed under the Apache License, Version 2.0(the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 * 
 * @version \$Revision.*\$
 * @author Olivier Combe
 */
public class SmokeTime {

    private int day = -1;
    private int hour = -1;
    private int minute = -1;
    private int seconds = -1;
    private int totalMinutes = -1;

    private double totalTime = -1;

    public SmokeTime() {

    }

    public void parse() {

        day = (int) totalTime;
        double remaining = totalTime - day;
        hour = (int) (remaining * 24);
        remaining = remaining - hour;
        minute = (int) (remaining * 60);
        totalMinutes = (day * 24 + hour) * 60 + minute;

        /*
         * hour = (int) (totalTime*24); minute = (int) (((totalTime*24) -hour)*60); totalMinutes = hour * 60 + minute;
         */

    }

    public void genTotalMinutes() {
        totalMinutes = hour * 60 + minute;
    }

    @Override
    public String toString() {
        return "D:" + day + " H: " + hour + " M: " + minute + " S: " + seconds + " / Total : " + totalMinutes + "("
                + totalTime + ")";
    }

    /**
     * @return the day
     */
    public int getDay() {
        return day;
    }

    /**
     * @param day
     *            the day to set
     */
    public void setDay(int day) {
        this.day = day;
    }

    /**
     * @return the hour
     */
    public int getHour() {
        return hour;
    }

    /**
     * @param hour
     *            the hour to set
     */
    public void setHour(int hour) {
        this.hour = hour;
    }

    /**
     * @return the minute
     */
    public int getMinute() {
        return minute;
    }

    /**
     * @param minute
     *            the minute to set
     */
    public void setMinute(int minute) {
        this.minute = minute;
    }

    /**
     * @return the seconds
     */
    public int getSeconds() {
        return seconds;
    }

    /**
     * @param seconds
     *            the seconds to set
     */
    public void setSeconds(int seconds) {
        this.seconds = seconds;
    }

    /**
     * @return the totalMinutes
     */
    public int getTotalMinutes() {
        return totalMinutes;
    }

    /**
     * @param totalMinutes
     *            the totalMinutes to set
     */
    public void setTotalMinutes(int totalMinutes) {
        this.totalMinutes = totalMinutes;
    }

    /**
     * @return the totalTime
     */
    public double getTotalTime() {
        return totalTime;
    }

    /**
     * @param totalTime
     *            the totalTime to set
     */
    public void setTotalTime(double totalTime) {
        this.totalTime = totalTime;
    }

}
